var e = getApp();

Page({
    data: {
        selected: "0"
    },
    onLoad: function(e) {
        this.getData();
    },
    swichTabTItem: function(e) {
        console.log(e.detail.index), this.setData({
            selected: e.detail.index
        }), this.getData();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), this.getNext(this.data.selected)) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    getNext: function() {
        var t = this, a = "";
        "0" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.index" : "1" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.carry-out" : "2" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.undone" : "3" == this.data.selected && (a = "plugin.pending-order.frontend.dividend.invalid");
        var n = e.getNetAddresss(a);
        e._getNetWork({
            url: n,
            success: function(e) {
                var a = e.data;
                if (1 == a.result) {
                    if (console.log(a), a.data.current_page > a.data.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void t.setData({
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                    wx.hideLoading(), t.setData({
                        info: t.data.info.concat(a.data.data),
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                } else console.log("请求失败");
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    onShareAppMessage: function() {},
    getData: function() {
        var t = this, a = "";
        "0" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.index" : "1" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.carry-out" : "2" == this.data.selected ? a = "plugin.pending-order.frontend.dividend.undone" : "3" == this.data.selected && (a = "plugin.pending-order.frontend.dividend.invalid");
        var n = e.getNetAddresss(a);
        e._getNetWork({
            url: n,
            success: function(e) {
                var a = e.data;
                1 == a.result ? t.setData({
                    info: a.data.data,
                    current_page: a.data.current_page,
                    last_page: a.data.last_page
                }) : console.log("请求失败"), 0 == a.result && t.setData({
                    info: !1,
                    errnone: a.msg
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    }
});